package com.java1412.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author java1412
 * @since 2023-02-21 12:05
 */
@RestController
@RefreshScope // 自动刷新,不属于全局配置
public class HelloController {

    // 定义变量来注入码云中配置文件中的信息
    @Value("${foo}")
    private String foo;

    @GetMapping(value = "/hi")
    public String hi() {
        return "你好," + foo; // 你好,foo version 3
    }
}
